package com.zhang.flink.utils;

/**
 * @title: 自定义布隆过滤器
 * @author: zhang
 * @date: 2022/2/27 09:57
 */
public class MyBloomFilter {
    private long cap;

    public MyBloomFilter(long cap) {
        this.cap = cap;
    }

    public long getOffset(String value) {
        long result = 0L;
        for (char c : value.toCharArray()) {
            result += result * 31 + c;
        }
        return result & (cap - 1);
    }
}
